package sites.manager.common.interceptor;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import sites.manager.common.kit.SessionKit;

/**
 * session拦截器，将session放置到SessionKit中
 *
 * @author zyg
 * @date 2022/4/15 20:17
 */
public class SessionInterceptor implements Interceptor {

    @Override
    public void intercept(Invocation invocation) {

        SessionKit.setSession(invocation.getController().getSession());
        try {
            invocation.invoke();
        } finally {
            SessionKit.remove();
        }

    }

}
